package com.heima.admin.controller.v1;

import com.heima.admin.service.ChannelSerice;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.ChannelDto;
import com.heima.model.wemedia.dtos.SaveChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
@RequestMapping("/api/v1/channel")
public class ChannelController {

    @Autowired
    private ChannelSerice channelSerice;

    @PostMapping("/list")
    private ResponseResult list(@RequestBody ChannelDto dto) {
        return channelSerice.list(dto);
    }

    @PostMapping("/save")
    private ResponseResult save(@RequestBody SaveChannelDto dto) {
        return channelSerice.save(dto);
    }

    @PostMapping("/update")
    private ResponseResult update(@RequestBody WmChannel channel) {
        return channelSerice.update(channel);
    }

    @GetMapping("/del/{id}")
    private ResponseResult deleteChannel(@PathVariable("id") Integer id){
        return channelSerice.deleteChannel(id);
    }

}
